Skip to content

fix: Copy extra components on darwin#259

Open
domwst wants to merge 3 commits into
oxalica:masterfrom
domwst:fix/copy-extra-components-on-darwin
Open

fix: Copy extra components on darwin#259
domwst wants to merge 3 commits into
oxalica:masterfrom
domwst:fix/copy-extra-components-on-darwin

Conversation

@domwst

@domwst domwst commented Jun 7, 2026

Copy link
Copy Markdown

Hi! After updating to a fresh version of rust I've started getting these kinds of errors from rust-lld on macos:

dyld[57979]: Library not loaded: @rpath/libLLVM.dylib
  Referenced from: <1A2A643B-408F-3C7A-B8A2-DC5EDCCD6D11> /nix/store/dsd8a65z7w5dl4i0h8g45qkc2hmk2vva-rustc-1.98.0-nightly-2026-06-02-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/rust-lld
  Reason: tried: '/nix/store/dsd8a65z7w5dl4i0h8g45qkc2hmk2vva-rustc-1.98.0-nightly-2026-06-02-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/../lib/libLLVM.dylib' (no such file), '/Users/runner/work/rust/rust/build/aarch64-apple-darwin/llvm/lib/libLLVM.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/work/rust/rust/build/aarch64-apple-darwin/llvm/lib/libLLVM.dylib' (no such file), '/nix/store/dsd8a65z7w5dl4i0h8g45qkc2hmk2vva-rustc-1.98.0-nightly-2026-06-02-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/../lib/libLLVM.dylib' (no such file), '/Users/runner/work/rust/rust/build/aarch64-apple-darwin/llvm/lib/libLLVM.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/work/rust/rust/build/aarch64-apple-darwin/llvm/lib/libLLVM.dylib' (no such file)

It looks like recent versions of helper binaries link dynamically to libLLVM.dylib. The tools live under lib/rustlib/<target>/bin and their rpath include @loader_path/../lib, so dyld expects LLVM at lib/rustlib/<target>/lib/libLLVM.dylib. However, the rustc component provides libLLVM.dylib under: lib/libLLVM.dylib, current fix symlinks the libLLVM.dylib into the corresponding relative path.

This issue was likely triggered by:
rust-lang/rust#157205

There is also
rust-lang/rust#157557
which will likely affect x86_64-darwin as well.

I've tested the fix on aarch64-darwin and x86_64-linux manually (although with llvm-tools-preview component enabled).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant